﻿using AutomaticPush.Common;
using AutomaticPush.Extension;
using AutomaticPush.Models;
using AutomaticPush.Models.DaZhang;
using AutoPushExt.DAL;
using Quartz.Util;
using System.Security.Policy;
using System.Windows.Forms;

namespace AutoPushExt.BLL
{

    /// <summary>
    /// 大张三方接口
    /// </summary>
    public class DazhangBLL : BaseBLL
    {
        private ThirdApiModel model;

        public ThirdApiModel Model { get => configs.ThirdApi.FirstOrDefault(x => x.Name == "xxx"); set => model = value; }



        /// <summary>
        /// 向大张推动验收单信息
        /// </summary>
        /// <returns></returns>
        public async Task PushOrderReceive()
        {
            try
            {
                DazhangDAL dazhangDAL = new DazhangDAL();
                dazhangDAL.UpdateReceiveInfo("1234");
                DZReceiveParam param = new DZReceiveParam();
                param.deliveryNo = "111";
                var url = $"{Model.HttpUrl}/api/v1/order";
                LogHelper.WriteLog("PushOrder_info", $"url:{url},param:{param.ToJson()}");
                var obj = await _webApiExt.PostAPI<DZApiResult>(url, param);
                LogHelper.WriteLog("PushOrder_Result", $"result:{obj.ToJson()}");
                if (obj.IsSuccess)
                {
                    //接口调用成功
                }


            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("PushOrderReceive_ex", ex.Message);
            }
        }


    }


}
